package com.wy.powerbuilder.controller.lwg;




import com.github.pagehelper.PageInfo;
import com.wy.powerbuilder.entity.lwg.houses;
import com.wy.powerbuilder.entity.lwg.owner;
import com.wy.powerbuilder.mapper.lwg.housesMapper;
import com.wy.powerbuilder.service.lwg.housesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Controller
public class housesConller {
    @Autowired
    private housesMapper housesMapper;

    @Autowired
    private housesService housesService;


    //查询
    @RequestMapping(value = {"/studen","/"})
   public String selByPage(Integer pageNum,Model model,String h_state) {
        PageInfo<houses> pageInfos = housesService.selByPages(pageNum, 8,h_state);
        model.addAttribute("pageInfos", pageInfos);


        return "fwxx";
    }



    //删除
    @RequestMapping("/delt")
    public String del(Integer h_id){
        int i = housesMapper.delete(h_id);
        System.out.println(i);
        //删除成功是不是又要进行查询
        return "redirect:/studen";
    }

    @RequestMapping("/addss")
    public String add(houses Houses){
        housesMapper.addUser(Houses);
        return "redirect:/studen";
    }

    }



